home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / QuickTime / QuickTime™ 2.5 / Interfaces for Programmers / PInterfaces / QuickTimeMusic.p < prev   
Encoding:
Text File  |  1997-02-26  |  57.7 KB  |  1,394 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QuickTimeMusic.p
  3.  
  4.      Contains:    QuickTime interfaces
  5.  
  6.      Version:    Technology:    
  7.                  Release:    QuickTime 2.5 interfaces to use with ETO #20
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT QuickTimeMusic;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __QUICKTIMEMUSIC__}
  28. {$SETC __QUICKTIMEMUSIC__ := 1}
  29.  
  30. {$I+}
  31. {$SETC QuickTimeMusicIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __COMPONENTS__}
  35. {$I Components.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __IMAGECOMPRESSION__}
  38. {$I ImageCompression.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __MOVIES__}
  41. {$I Movies.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __QUICKDRAW__}
  44. {$I Quickdraw.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __VIDEO__}
  47. {$I Video.p}
  48. {$ENDC}
  49. {$IFC UNDEFINED __MEMORY__}
  50. {$I Memory.p}
  51. {$ENDC}
  52. {$IFC UNDEFINED __SOUND__}
  53. {$I Sound.p}
  54. {$ENDC}
  55.  
  56. {$PUSH}
  57. {$ALIGN MAC68K}
  58. {$LibExport+}
  59.  
  60.  
  61. CONST
  62.     kaiToneDescType                = 'tone';
  63.     kaiNoteRequestInfoType        = 'ntrq';
  64.     kaiKnobListType                = 'knbl';
  65.     kaiKeyRangeInfoType            = 'sinf';
  66.     kaiSampleDescType            = 'sdsc';
  67.     kaiSampleInfoType            = 'smin';
  68.     kaiSampleDataType            = 'sdat';
  69.     kaiInstInfoType                = 'iinf';
  70.     kaiPictType                    = 'pict';
  71.     kaiWriterType                = '©wrt';
  72.     kaiCopyrightType            = '©cpy';
  73.     kaiOtherStrType                = 'str ';
  74.     kaiInstrumentRefType        = 'iref';
  75.     kaiLibraryInfoType            = 'linf';
  76.     kaiLibraryDescType            = 'ldsc';
  77.  
  78.  
  79. TYPE
  80.     InstLibDescRecPtr = ^InstLibDescRec;
  81.     InstLibDescRec = RECORD
  82.         libIDName:                Str31;
  83.     END;
  84.  
  85.     InstKnobRecPtr = ^InstKnobRec;
  86.     InstKnobRec = RECORD
  87.         number:                    LONGINT;
  88.         value:                    LONGINT;
  89.     END;
  90.  
  91.  
  92. CONST
  93.     kInstKnobMissingUnknown        = 0;
  94.     kInstKnobMissingDefault        = $01;
  95.  
  96.  
  97. TYPE
  98.     InstKnobListPtr = ^InstKnobList;
  99.     InstKnobList = RECORD
  100.         knobCount:                LONGINT;
  101.         knobFlags:                LONGINT;
  102.         knob:                    ARRAY [0..0] OF InstKnobRec;
  103.     END;
  104.  
  105.  
  106. CONST
  107.     kMusicLoopTypeNormal        = 0;
  108.     kMusicLoopTypePalindrome    = 1;                            {  back & forth }
  109.  
  110.     instSamplePreProcessFlag    = $01;
  111.  
  112.  
  113. TYPE
  114.     InstSampleDescRecPtr = ^InstSampleDescRec;
  115.     InstSampleDescRec = RECORD
  116.         dataFormat:                OSType;
  117.         numChannels:            INTEGER;
  118.         sampleSize:                INTEGER;
  119.         sampleRate:                UnsignedFixed;
  120.         sampleDataID:            INTEGER;
  121.         offset:                    LONGINT;                                {  offset within SampleData - this could be just for internal use }
  122.         numSamples:                LONGINT;                                {  this could also just be for internal use, we'll see }
  123.         loopType:                LONGINT;
  124.         loopStart:                LONGINT;
  125.         loopEnd:                LONGINT;
  126.         pitchNormal:            LONGINT;
  127.         pitchLow:                LONGINT;
  128.         pitchHigh:                LONGINT;
  129.     END;
  130.  
  131.     AtomicInstrument                    = Handle;
  132.     AtomicInstrumentPtr                    = Ptr;
  133.  
  134. CONST
  135.     kMusicComponentType            = 'musi';
  136.  
  137.     kSoftSynthComponentSubType    = 'ss  ';
  138.     kGMSynthComponentSubType    = 'gm  ';
  139.  
  140.  
  141. TYPE
  142.     MusicComponent                        = ComponentInstance;
  143. {  MusicSynthesizerFlags }
  144.  
  145. CONST
  146.     kSynthesizerDynamicVoice    = $01;                            {  can assign voices on the fly (else, polyphony is very important  }
  147.     kSynthesizerUsesMIDIPort    = $02;                            {  must be patched through MIDI Manager  }
  148.     kSynthesizerMicrotone        = $04;                            {  can play microtonal scales  }
  149.     kSynthesizerHasSamples        = $08;                            {  synthesizer has some use for sampled data  }
  150.     kSynthesizerMixedDrums        = $10;                            {  any part can play drum parts, total = instrument parts  }
  151.     kSynthesizerSoftware        = $20;                            {  implemented in main CPU software == uses cpu cycles  }
  152.     kSynthesizerHardware        = $40;                            {  is a hardware device (such as nubus, or maybe DSP?)  }
  153.     kSynthesizerDynamicChannel    = $80;                            {  can move any part to any channel or disable each part. (else we assume it lives on all channels in masks)  }
  154.     kSynthesizerHogsSystemChannel = $0100;                        {  can be channelwise dynamic, but always responds on its system channel  }
  155.     kSynthesizerSlowSetPart        = $0400;                        {  SetPart() and SetPartInstrumentNumber() calls do not have rapid response, may glitch notes  }
  156.     kSynthesizerOffline            = $1000;                        {  can enter an offline synthesis mode  }
  157.     kSynthesizerGM                = $4000;                        {  synth is a GM device  }
  158.     kSynthesizerSoundLocalization = $00010000;                    {  synth is a GM device  }
  159.  
  160. {
  161.  * Note that these controller numbers
  162.  * are _not_ identical to the MIDI controller numbers.
  163.  * These are _signed_ 8.8 values, and the LSB's are
  164.  * always sent to a MIDI device. Controllers 32-63 are
  165.  * reserved (for MIDI, they are LSB's for 0-31, but we
  166.  * always send both).
  167.  *
  168.  * The full range, therefore, is -128.00 to 127.7f.
  169.  *
  170.  * _Excepting_ _volume_, all controls default to zero.
  171.  *
  172.  * Pitch bend is specified in fractional semitones! No
  173.  * more "pitch bend range" nonsense. You can bend as far
  174.  * as you want, any time you want.
  175. }
  176.  
  177. TYPE
  178.     MusicController                        = SInt32;
  179.  
  180. CONST
  181.     kControllerModulationWheel    = 1;
  182.     kControllerBreath            = 2;
  183.     kControllerFoot                = 4;
  184.     kControllerPortamentoTime    = 5;                            {  portamento on/off is omitted, 0 time = 'off'  }
  185.     kControllerVolume            = 7;
  186.     kControllerBalance            = 8;
  187.     kControllerPan                = 10;                            {  0 - "default", 1 - n: positioned in output 1-n (incl fractions)  }
  188.     kControllerExpression        = 11;
  189.     kControllerLever1            = 16;                            {  general purpose controllers  }
  190.     kControllerLever2            = 17;                            {  general purpose controllers  }
  191.     kControllerLever3            = 18;                            {  general purpose controllers  }
  192.     kControllerLever4            = 19;                            {  general purpose controllers  }
  193.     kControllerLever5            = 80;                            {  general purpose controllers  }
  194.     kControllerLever6            = 81;                            {  general purpose controllers  }
  195.     kControllerLever7            = 82;                            {  general purpose controllers  }
  196.     kControllerLever8            = 83;                            {  general purpose controllers  }
  197.     kControllerPitchBend        = 32;                            {  positive & negative semitones, with 7 bits fraction  }
  198.     kControllerAfterTouch        = 33;                            {  aka channel pressure  }
  199.     kControllerSustain            = 64;                            {  boolean - positive for on, 0 or negative off  }
  200.     kControllerSostenuto        = 66;                            {  boolean  }
  201.     kControllerSoftPedal        = 67;                            {  boolean  }
  202.     kControllerReverb            = 91;
  203.     kControllerTremolo            = 92;
  204.     kControllerChorus            = 93;
  205.     kControllerCeleste            = 94;
  206.     kControllerPhaser            = 95;
  207.     kControllerEditPart            = 113;                            {  last 16 controllers 113-128 and above are global controllers which respond on part zero  }
  208.     kControllerMasterTune        = 114;
  209.  
  210.     kControllerMaximum            = $7FFF;                        {  +01111111.11111111  }
  211.     kControllerMinimum            = $8000;                        {  -10000000.00000000  }
  212.  
  213.  
  214. TYPE
  215.     SynthesizerDescriptionPtr = ^SynthesizerDescription;
  216.     SynthesizerDescription = RECORD
  217.         synthesizerType:        OSType;                                    {  synthesizer type (must be same as component subtype)  }
  218.         name:                    Str31;                                    {  text name of synthesizer type  }
  219.         flags:                    LONGINT;                                {  from the above enum  }
  220.         voiceCount:                LONGINT;                                {  maximum polyphony  }
  221.         partCount:                LONGINT;                                {  maximum multi-timbrality (and midi channels)  }
  222.         instrumentCount:        LONGINT;                                {  non gm, built in (rom) instruments only  }
  223.         modifiableInstrumentCount: LONGINT;                                {  plus n-more are user modifiable  }
  224.         channelMask:            LONGINT;                                {  (midi device only) which channels device always uses  }
  225.         drumPartCount:            LONGINT;                                {  maximum multi-timbrality of drum parts  }
  226.         drumCount:                LONGINT;                                {  non gm, built in (rom) drumkits only  }
  227.         modifiableDrumCount:    LONGINT;                                {  plus n-more are user modifiable  }
  228.         drumChannelMask:        LONGINT;                                {  (midi device only) which channels device always uses  }
  229.         outputCount:            LONGINT;                                {  number of audio outputs (usually two)  }
  230.         latency:                LONGINT;                                {  response time in µSec  }
  231.         controllers:            ARRAY [0..3] OF LONGINT;                {  array of 128 bits  }
  232.         gmInstruments:            ARRAY [0..3] OF LONGINT;                {  array of 128 bits  }
  233.         gmDrums:                ARRAY [0..3] OF LONGINT;                {  array of 128 bits  }
  234.     END;
  235.  
  236.  
  237. CONST
  238.     kVoiceCountDynamic            = -1;                            {  constant to use to specify dynamic voicing  }
  239.  
  240.  
  241. TYPE
  242.     ToneDescriptionPtr = ^ToneDescription;
  243.     ToneDescription = RECORD
  244.         synthesizerType:        OSType;                                    {  synthesizer type  }
  245.         synthesizerName:        Str31;                                    {  name of instantiation of synth  }
  246.         instrumentName:            Str31;                                    {  preferred name for human use  }
  247.         instrumentNumber:        LONGINT;                                {  inst-number used if synth-name matches  }
  248.         gmNumber:                LONGINT;                                {  Best matching general MIDI number  }
  249.     END;
  250.  
  251.  
  252. CONST
  253.     kFirstDrumkit                = 16384;                        {  (first value is "no drum". instrument numbers from 16384->16384+128 are drumkits, and for GM they are _defined_ drumkits!  }
  254.     kLastDrumkit                = 16512;
  255.  
  256. {  InstrumentMatch }
  257.     kInstrumentMatchSynthesizerType = 1;
  258.     kInstrumentMatchSynthesizerName = 2;
  259.     kInstrumentMatchName        = 4;
  260.     kInstrumentMatchNumber        = 8;
  261.     kInstrumentMatchGMNumber    = 16;
  262.  
  263. {  KnobFlags }
  264.     kKnobReadOnly                = 16;                            {  knob value cannot be changed by user or with a SetKnob call  }
  265.     kKnobInterruptUnsafe        = 32;                            {  only alter this knob from foreground task time (may access toolbox)  }
  266.     kKnobKeyrangeOverride        = 64;                            {  knob can be overridden within a single keyrange (software synth only)  }
  267.     kKnobGroupStart                = 128;                            {  knob is first in some logical group of knobs  }
  268.     kKnobFixedPoint8            = 1024;
  269.     kKnobFixedPoint16            = 2048;                            {  One of these may be used at a time.  }
  270.     kKnobTypeNumber                = $00;
  271.     kKnobTypeGroupName            = $1000;                        {  "knob" is really a group name for display purposes  }
  272.     kKnobTypeBoolean            = $2000;                        {  if range is greater than 1, its a multi-checkbox field  }
  273.     kKnobTypeNote                = $3000;                        {  knob range is equivalent to MIDI keys  }
  274.     kKnobTypePan                = $4000;                        {  range goes left/right (lose this? )  }
  275.     kKnobTypeInstrument            = $5000;                        {  knob value = reference to another instrument number  }
  276.     kKnobTypeSetting            = $6000;                        {  knob value is 1 of n different things (eg, fm algorithms) popup menu  }
  277.     kKnobTypeMilliseconds        = $7000;                        {  knob is a millisecond time range  }
  278.     kKnobTypePercentage            = $8000;                        {  knob range is displayed as a Percentage  }
  279.     kKnobTypeHertz                = $9000;                        {  knob represents frequency  }
  280.     kKnobTypeButton                = $A000;                        {  momentary trigger push button  }
  281.  
  282.     kUnknownKnobValue            = $7FFFFFFF;                    {  a knob with this value means, we don't know it.  }
  283.     kDefaultKnobValue            = $7FFFFFFE;                    {  used to SET a knob to its default value.  }
  284.  
  285.  
  286. TYPE
  287.     KnobDescriptionPtr = ^KnobDescription;
  288.     KnobDescription = RECORD
  289.         name:                    Str63;
  290.         lowValue:                LONGINT;
  291.         highValue:                LONGINT;
  292.         defaultValue:            LONGINT;                                {  a default instrument is made of all default values  }
  293.         flags:                    LONGINT;
  294.         knobID:                    LONGINT;
  295.     END;
  296.  
  297.     GCInstrumentDataPtr = ^GCInstrumentData;
  298.     GCInstrumentData = RECORD
  299.         tone:                    ToneDescription;
  300.         knobCount:                LONGINT;
  301.         knob:                    ARRAY [0..0] OF LONGINT;
  302.     END;
  303.  
  304.     GCInstrumentDataHandle                = ^GCInstrumentDataPtr;
  305.     InstrumentAboutInfoPtr = ^InstrumentAboutInfo;
  306.     InstrumentAboutInfo = RECORD
  307.         p:                        PicHandle;
  308.         author:                    Str255;
  309.         copyright:                Str255;
  310.         other:                    Str255;
  311.     END;
  312.  
  313.  
  314. CONST
  315.     kMusicPacketPortLost        = 1;                            {  received when application loses the default input port  }
  316.     kMusicPacketPortFound        = 2;                            {  received when application gets it back out from under someone else's claim  }
  317.     kMusicPacketTimeGap            = 3;                            {  data[0] = number of milliseconds to keep the MIDI line silent  }
  318.  
  319.  
  320. TYPE
  321.     MusicMIDIPacketPtr = ^MusicMIDIPacket;
  322.     MusicMIDIPacket = RECORD
  323.         length:                    INTEGER;
  324.         reserved:                LONGINT;                                {  if length zero, then reserved = above enum  }
  325.         data:                    PACKED ARRAY [0..248] OF UInt8;
  326.     END;
  327.  
  328.     MusicMIDISendProcPtr = ProcPtr;  { FUNCTION MusicMIDISend(self: MusicComponent; refCon: LONGINT; VAR mmp: MusicMIDIPacket): ComponentResult; }
  329.  
  330.     MusicMIDISendUPP = UniversalProcPtr;
  331.     MusicMIDIReadHookProcPtr = ProcPtr;  { FUNCTION MusicMIDIReadHook(VAR mp: MusicMIDIPacket; myRefCon: LONGINT): ComponentResult; }
  332.  
  333.     MusicMIDIReadHookUPP = UniversalProcPtr;
  334.  
  335. CONST
  336.     notImplementedMusicErr        = $8000F7E9;
  337.     cantSendToSynthesizerErr    = $8000F7E8;
  338.     cantReceiveFromSynthesizerErr = $8000F7E7;
  339.     illegalVoiceAllocationErr    = $8000F7E6;
  340.     illegalPartErr                = $8000F7E5;
  341.     illegalChannelErr            = $8000F7E4;
  342.     illegalKnobErr                = $8000F7E3;
  343.     illegalKnobValueErr            = $8000F7E2;
  344.     illegalInstrumentErr        = $8000F7E1;
  345.     illegalControllerErr        = $8000F7E0;
  346.     midiManagerAbsentErr        = $8000F7DF;
  347.     synthesizerNotRespondingErr    = $8000F7DE;
  348.     synthesizerErr                = $8000F7DD;
  349.     illegalNoteChannelErr        = $8000F7DC;
  350.     noteChannelNotAllocatedErr    = $8000F7DB;
  351.     tunePlayerFullErr            = $8000F7DA;
  352.     tuneParseErr                = $8000F7D9;
  353.  
  354.     kGetAtomicInstNoExpandedSamples = $01;
  355.     kGetAtomicInstNoOriginalSamples = $02;
  356.     kGetAtomicInstNoSamples        = $03;
  357.     kGetAtomicInstNoKnobList    = $04;
  358.     kGetAtomicInstNoInstrumentInfo = $08;
  359.     kGetAtomicInstOriginalKnobList = $10;
  360.     kGetAtomicInstAllKnobs        = $20;                            {  return even those that are set to default }
  361.  
  362. {
  363.  For non-gm instruments, instrument number of tone description == 0
  364.  If you want to speed up while running, slam the inst num with what Get instrument number returns
  365.  All missing knobs are slammed to the default value
  366. }
  367.     kSetAtomicInstKeepOriginalInstrument = $01;
  368.     kSetAtomicInstShareAcrossParts = $02;                        {  inst disappears when app goes away }
  369.     kSetAtomicInstCallerTosses    = $04;                            {  the caller isn't keeping a copy around (for NASetAtomicInstrument) }
  370.     kSetAtomicInstCallerGuarantees = $08;                        {  the caller guarantees a copy is around }
  371.     kSetAtomicInstInterruptSafe    = $10;                            {  dont move memory at this time (but process at next task time) }
  372.     kSetAtomicInstDontPreprocess = $80;                            {  perform no further preprocessing because either 1)you know the instrument is digitally clean, or 2) you got it from a GetPartAtomic }
  373.  
  374.     kInstrumentNamesModifiable    = 1;
  375.     kInstrumentNamesBoth        = 2;
  376.  
  377. {
  378.  * Structures specific to the GenericMusicComponent
  379. }
  380.     kGenericMusicComponentSubtype = 'gene';
  381.  
  382.  
  383. TYPE
  384.     GenericKnobDescriptionPtr = ^GenericKnobDescription;
  385.     GenericKnobDescription = RECORD
  386.         kd:                        KnobDescription;
  387.         hw1:                    LONGINT;                                {  driver defined  }
  388.         hw2:                    LONGINT;                                {  driver defined  }
  389.         hw3:                    LONGINT;                                {  driver defined  }
  390.         settingsID:                LONGINT;                                {  resource ID list for boolean and popup names  }
  391.     END;
  392.  
  393.     GenericKnobDescriptionListPtr = ^GenericKnobDescriptionList;
  394.     GenericKnobDescriptionList = RECORD
  395.         knobCount:                LONGINT;
  396.         knob:                    ARRAY [0..0] OF GenericKnobDescription;
  397.     END;
  398.  
  399.     GenericKnobDescriptionListHandle    = ^GenericKnobDescriptionListPtr;
  400. {  knobTypes for MusicDerivedSetKnob  }
  401.  
  402. CONST
  403.     kGenericMusicKnob            = 1;
  404.     kGenericMusicInstrumentKnob    = 2;
  405.     kGenericMusicDrumKnob        = 3;
  406.     kGenericMusicGlobalController = 4;
  407.  
  408.     kGenericMusicResFirst        = 0;
  409.     kGenericMusicResMiscStringList = 1;                            {  STR# 1: synth name, 2:about author,3:aboutcopyright,4:aboutother  }
  410.     kGenericMusicResMiscLongList = 2;                            {  Long various params, see list below  }
  411.     kGenericMusicResInstrumentList = 3;                            {  NmLs of names and shorts, categories prefixed by '••'  }
  412.     kGenericMusicResDrumList    = 4;                            {  NmLs of names and shorts  }
  413.     kGenericMusicResInstrumentKnobDescriptionList = 5;            {  Knob  }
  414.     kGenericMusicResDrumKnobDescriptionList = 6;                {  Knob  }
  415.     kGenericMusicResKnobDescriptionList = 7;                    {  Knob  }
  416.     kGenericMusicResBitsLongList = 8;                            {  Long back to back bitmaps of controllers, gminstruments, and drums  }
  417.     kGenericMusicResModifiableInstrumentHW = 9;                    {  Shrt same as the hw shorts trailing the instrument names, a shortlist  }
  418.     kGenericMusicResGMTranslation = 10;                            {  Long 128 long entries, 1 for each gm inst, of local instrument numbers 1-n (not hw numbers)  }
  419.     kGenericMusicResROMInstrumentData = 11;                        {  knob lists for ROM instruments, so the knob values may be known  }
  420.     kGenericMusicResAboutPICT    = 12;                            {  picture for aboutlist. must be present for GetAbout call to work  }
  421.     kGenericMusicResLast        = 13;
  422.  
  423. {  elements of the misc long list  }
  424.     kGenericMusicMiscLongFirst    = 0;
  425.     kGenericMusicMiscLongVoiceCount = 1;
  426.     kGenericMusicMiscLongPartCount = 2;
  427.     kGenericMusicMiscLongModifiableInstrumentCount = 3;
  428.     kGenericMusicMiscLongChannelMask = 4;
  429.     kGenericMusicMiscLongDrumPartCount = 5;
  430.     kGenericMusicMiscLongModifiableDrumCount = 6;
  431.     kGenericMusicMiscLongDrumChannelMask = 7;
  432.     kGenericMusicMiscLongOutputCount = 8;
  433.     kGenericMusicMiscLongLatency = 9;
  434.     kGenericMusicMiscLongFlags    = 10;
  435.     kGenericMusicMiscLongFirstGMHW = 11;                        {  number to add to locate GM main instruments  }
  436.     kGenericMusicMiscLongFirstGMDrumHW = 12;                    {  number to add to locate GM drumkits  }
  437.     kGenericMusicMiscLongFirstUserHW = 13;                        {  First hw number of user instruments (presumed sequential)  }
  438.     kGenericMusicMiscLongLast    = 14;
  439.  
  440.  
  441. TYPE
  442.     GCPartPtr = ^GCPart;
  443.     GCPart = RECORD
  444.         hwInstrumentNumber:        LONGINT;                                {  internal number of recalled instrument  }
  445.         controller:                ARRAY [0..127] OF INTEGER;                {  current values for all controllers  }
  446.         volume:                    LONGINT;                                {  ctrl 7 is special case  }
  447.         polyphony:                LONGINT;
  448.         midiChannel:            LONGINT;                                {  1-16 if in use  }
  449.         id:                        GCInstrumentData;                        {  ToneDescription & knoblist, uncertain length  }
  450.     END;
  451.  
  452. {
  453.  * Calls specific to the GenericMusicComponent
  454. }
  455.  
  456. CONST
  457.     kMusicGenericRange            = $0100;
  458.     kMusicDerivedRange            = $0200;
  459.  
  460. {
  461.  * Flags in GenericMusicConfigure call
  462. }
  463.     kGenericMusicDoMIDI            = $01;                            {  implement normal MIDI messages for note, controllers, and program changes 0-127  }
  464.     kGenericMusicBank0            = $02;                            {  implement instrument bank changes on controller 0  }
  465.     kGenericMusicBank32            = $04;                            {  implement instrument bank changes on controller 32  }
  466.     kGenericMusicErsatzMIDI        = $08;                            {  construct MIDI packets, but send them to the derived component  }
  467.     kGenericMusicCallKnobs        = $10;                            {  call the derived component with special knob format call  }
  468.     kGenericMusicCallParts        = $20;                            {  call the derived component with special part format call  }
  469.     kGenericMusicCallInstrument    = $40;                            {  call MusicDerivedSetInstrument for MusicSetInstrument calls  }
  470.     kGenericMusicCallNumber        = $80;                            {  call MusicDerivedSetPartInstrumentNumber for MusicSetPartInstrumentNumber calls, & don't send any C0 or bank stuff  }
  471.     kGenericMusicCallROMInstrument = $0100;                        {  call MusicSetInstrument for MusicSetPartInstrumentNumber for "ROM" instruments, passing params from the ROMi resource  }
  472.     kGenericMusicAllDefaults    = $0200;                        {  indicates that when a new instrument is recalled, all knobs are reset to DEFAULT settings. True for GS modules  }
  473.  
  474.  
  475. TYPE
  476.     MusicOfflineDataProcPtr = ProcPtr;  { FUNCTION MusicOfflineData(SoundData: Ptr; numBytes: LONGINT; myRefCon: LONGINT): ComponentResult; }
  477.  
  478.     MusicOfflineDataUPP = UniversalProcPtr;
  479.     OfflineSampleTypePtr = ^OfflineSampleType;
  480.     OfflineSampleType = RECORD
  481.         numChannels:            LONGINT;                                { number of channels,  ie mono = 1 }
  482.         sampleRate:                UnsignedFixed;                            { sample rate in Apples Fixed point representation }
  483.         sampleSize:                INTEGER;                                { number of bits in sample }
  484.     END;
  485.  
  486.     InstrumentInfoRecordPtr = ^InstrumentInfoRecord;
  487.     InstrumentInfoRecord = RECORD
  488.         instrumentNumber:        LONGINT;                                {  instrument number (if 0, name is a catagory) }
  489.         flags:                    LONGINT;                                {  show in picker, etc. }
  490.         toneNameIndex:            LONGINT;                                {  index in toneNames (1 based) }
  491.         itxtNameAtomID:            LONGINT;                                {  index in itxtNames (itxt/name by index) }
  492.     END;
  493.  
  494.     InstrumentInfoListPtr = ^InstrumentInfoList;
  495.     InstrumentInfoList = RECORD
  496.         recordCount:            LONGINT;
  497.         toneNames:                Handle;                                    {  name from tone description }
  498.         itxtNames:                QTAtomContainer;                        {  itxt/name atoms for instruments }
  499.         info:                    ARRAY [0..0] OF InstrumentInfoRecord;
  500.     END;
  501.  
  502.     InstrumentInfoListHandle            = ^InstrumentInfoListPtr;
  503. FUNCTION MusicGetDescription(mc: MusicComponent; VAR sd: SynthesizerDescription): ComponentResult;
  504.     {$IFC NOT GENERATINGCFM}
  505.     INLINE $2F3C, $0004, $0001, $7000, $A82A;
  506.     {$ENDC}
  507. FUNCTION MusicGetPart(mc: MusicComponent; part: LONGINT; VAR midiChannel: LONGINT; VAR polyphony: LONGINT): ComponentResult;
  508.     {$IFC NOT GENERATINGCFM}
  509.     INLINE $2F3C, $000C, $0002, $7000, $A82A;
  510.     {$ENDC}
  511. FUNCTION MusicSetPart(mc: MusicComponent; part: LONGINT; midiChannel: LONGINT; polyphony: LONGINT): ComponentResult;
  512.     {$IFC NOT GENERATINGCFM}
  513.     INLINE $2F3C, $000C, $0003, $7000, $A82A;
  514.     {$ENDC}
  515. FUNCTION MusicSetPartInstrumentNumber(mc: MusicComponent; part: LONGINT; instrumentNumber: LONGINT): ComponentResult;
  516.     {$IFC NOT GENERATINGCFM}
  517.     INLINE $2F3C, $0008, $0004, $7000, $A82A;
  518.     {$ENDC}
  519. FUNCTION MusicGetPartInstrumentNumber(mc: MusicComponent; part: LONGINT): ComponentResult;
  520.     {$IFC NOT GENERATINGCFM}
  521.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  522.     {$ENDC}
  523. FUNCTION MusicStorePartInstrument(mc: MusicComponent; part: LONGINT; instrumentNumber: LONGINT): ComponentResult;
  524.     {$IFC NOT GENERATINGCFM}
  525.     INLINE $2F3C, $0008, $0006, $7000, $A82A;
  526.     {$ENDC}
  527. FUNCTION MusicGetPartAtomicInstrument(mc: MusicComponent; part: LONGINT; VAR ai: AtomicInstrument; flags: LONGINT): ComponentResult;
  528.     {$IFC NOT GENERATINGCFM}
  529.     INLINE $2F3C, $000C, $0009, $7000, $A82A;
  530.     {$ENDC}
  531. FUNCTION MusicSetPartAtomicInstrument(mc: MusicComponent; part: LONGINT; aiP: AtomicInstrumentPtr; flags: LONGINT): ComponentResult;
  532.     {$IFC NOT GENERATINGCFM}
  533.     INLINE $2F3C, $000C, $000A, $7000, $A82A;
  534.     {$ENDC}
  535. {  Obsolete calls }
  536. FUNCTION MusicGetInstrumentKnobDescriptionObsolete(mc: MusicComponent; knobIndex: LONGINT; mkd: UNIV Ptr): ComponentResult;
  537.     {$IFC NOT GENERATINGCFM}
  538.     INLINE $2F3C, $0008, $000D, $7000, $A82A;
  539.     {$ENDC}
  540. FUNCTION MusicGetDrumKnobDescriptionObsolete(mc: MusicComponent; knobIndex: LONGINT; mkd: UNIV Ptr): ComponentResult;
  541.     {$IFC NOT GENERATINGCFM}
  542.     INLINE $2F3C, $0008, $000E, $7000, $A82A;
  543.     {$ENDC}
  544. FUNCTION MusicGetKnobDescriptionObsolete(mc: MusicComponent; knobIndex: LONGINT; mkd: UNIV Ptr): ComponentResult;
  545.     {$IFC NOT GENERATINGCFM}
  546.     INLINE $2F3C, $0008, $000F, $7000, $A82A;
  547.     {$ENDC}
  548. FUNCTION MusicGetPartKnob(mc: MusicComponent; part: LONGINT; knobID: LONGINT): ComponentResult;
  549.     {$IFC NOT GENERATINGCFM}
  550.     INLINE $2F3C, $0008, $0010, $7000, $A82A;
  551.     {$ENDC}
  552. FUNCTION MusicSetPartKnob(mc: MusicComponent; part: LONGINT; knobID: LONGINT; knobValue: LONGINT): ComponentResult;
  553.     {$IFC NOT GENERATINGCFM}
  554.     INLINE $2F3C, $000C, $0011, $7000, $A82A;
  555.     {$ENDC}
  556. FUNCTION MusicGetKnob(mc: MusicComponent; knobID: LONGINT): ComponentResult;
  557.     {$IFC NOT GENERATINGCFM}
  558.     INLINE $2F3C, $0004, $0012, $7000, $A82A;
  559.     {$ENDC}
  560. FUNCTION MusicSetKnob(mc: MusicComponent; knobID: LONGINT; knobValue: LONGINT): ComponentResult;
  561.     {$IFC NOT GENERATINGCFM}
  562.     INLINE $2F3C, $0008, $0013, $7000, $A82A;
  563.     {$ENDC}
  564. FUNCTION MusicGetPartName(mc: MusicComponent; part: LONGINT; name: StringPtr): ComponentResult;
  565.     {$IFC NOT GENERATINGCFM}
  566.     INLINE $2F3C, $0008, $0014, $7000, $A82A;
  567.     {$ENDC}
  568. FUNCTION MusicSetPartName(mc: MusicComponent; part: LONGINT; name: StringPtr): ComponentResult;
  569.     {$IFC NOT GENERATINGCFM}
  570.     INLINE $2F3C, $0008, $0015, $7000, $A82A;
  571.     {$ENDC}
  572. FUNCTION MusicFindTone(mc: MusicComponent; VAR td: ToneDescription; VAR instrumentNumber: LONGINT; VAR fit: LONGINT): ComponentResult;
  573.     {$IFC NOT GENERATINGCFM}
  574.     INLINE $2F3C, $000C, $0016, $7000, $A82A;
  575.     {$ENDC}
  576. FUNCTION MusicPlayNote(mc: MusicComponent; part: LONGINT; pitch: LONGINT; velocity: LONGINT): ComponentResult;
  577.     {$IFC NOT GENERATINGCFM}
  578.     INLINE $2F3C, $000C, $0017, $7000, $A82A;
  579.     {$ENDC}
  580. FUNCTION MusicResetPart(mc: MusicComponent; part: LONGINT): ComponentResult;
  581.     {$IFC NOT GENERATINGCFM}
  582.     INLINE $2F3C, $0004, $0018, $7000, $A82A;
  583.     {$ENDC}
  584. FUNCTION MusicSetPartController(mc: MusicComponent; part: LONGINT; controllerNumber: MusicController; controllerValue: LONGINT): ComponentResult;
  585.     {$IFC NOT GENERATINGCFM}
  586.     INLINE $2F3C, $000C, $0019, $7000, $A82A;
  587.     {$ENDC}
  588. FUNCTION MusicGetPartController(mc: MusicComponent; part: LONGINT; controllerNumber: MusicController): ComponentResult;
  589.     {$IFC NOT GENERATINGCFM}
  590.     INLINE $2F3C, $0008, $001A, $7000, $A82A;
  591.     {$ENDC}
  592. FUNCTION MusicGetMIDIProc(mc: MusicComponent; VAR midiSendProc: MusicMIDISendUPP; VAR refCon: LONGINT): ComponentResult;
  593.     {$IFC NOT GENERATINGCFM}
  594.     INLINE $2F3C, $0008, $001B, $7000, $A82A;
  595.     {$ENDC}
  596. FUNCTION MusicSetMIDIProc(mc: MusicComponent; midiSendProc: MusicMIDISendUPP; refCon: LONGINT): ComponentResult;
  597.     {$IFC NOT GENERATINGCFM}
  598.     INLINE $2F3C, $0008, $001C, $7000, $A82A;
  599.     {$ENDC}
  600. FUNCTION MusicGetInstrumentNames(mc: MusicComponent; modifiableInstruments: LONGINT; VAR instrumentNames: Handle; VAR instrumentCategoryLasts: Handle; VAR instrumentCategoryNames: Handle): ComponentResult;
  601.     {$IFC NOT GENERATINGCFM}
  602.     INLINE $2F3C, $0010, $001D, $7000, $A82A;
  603.     {$ENDC}
  604. FUNCTION MusicGetDrumNames(mc: MusicComponent; modifiableInstruments: LONGINT; VAR instrumentNumbers: Handle; VAR instrumentNames: Handle): ComponentResult;
  605.     {$IFC NOT GENERATINGCFM}
  606.     INLINE $2F3C, $000C, $001E, $7000, $A82A;
  607.     {$ENDC}
  608. FUNCTION MusicGetMasterTune(mc: MusicComponent): ComponentResult;
  609.     {$IFC NOT GENERATINGCFM}
  610.     INLINE $2F3C, $0000, $001F, $7000, $A82A;
  611.     {$ENDC}
  612. FUNCTION MusicSetMasterTune(mc: MusicComponent; masterTune: LONGINT): ComponentResult;
  613.     {$IFC NOT GENERATINGCFM}
  614.     INLINE $2F3C, $0004, $0020, $7000, $A82A;
  615.     {$ENDC}
  616. FUNCTION MusicGetInstrumentAboutInfo(mc: MusicComponent; part: LONGINT; VAR iai: InstrumentAboutInfo): ComponentResult;
  617.     {$IFC NOT GENERATINGCFM}
  618.     INLINE $2F3C, $0008, $0022, $7000, $A82A;
  619.     {$ENDC}
  620. FUNCTION MusicGetDeviceConnection(mc: MusicComponent; index: LONGINT; VAR id1: LONGINT; VAR id2: LONGINT): ComponentResult;
  621.     {$IFC NOT GENERATINGCFM}
  622.     INLINE $2F3C, $000C, $0023, $7000, $A82A;
  623.     {$ENDC}
  624. FUNCTION MusicUseDeviceConnection(mc: MusicComponent; id1: LONGINT; id2: LONGINT): ComponentResult;
  625.     {$IFC NOT GENERATINGCFM}
  626.     INLINE $2F3C, $0008, $0024, $7000, $A82A;
  627.     {$ENDC}
  628. FUNCTION MusicGetKnobSettingStrings(mc: MusicComponent; knobIndex: LONGINT; isGlobal: LONGINT; VAR settingsNames: Handle; VAR settingsCategoryLasts: Handle; VAR settingsCategoryNames: Handle): ComponentResult;
  629.     {$IFC NOT GENERATINGCFM}
  630.     INLINE $2F3C, $0014, $0025, $7000, $A82A;
  631.     {$ENDC}
  632. FUNCTION MusicGetMIDIPorts(mc: MusicComponent; VAR inputPortCount: LONGINT; VAR outputPortCount: LONGINT): ComponentResult;
  633.     {$IFC NOT GENERATINGCFM}
  634.     INLINE $2F3C, $0008, $0026, $7000, $A82A;
  635.     {$ENDC}
  636. FUNCTION MusicSendMIDI(mc: MusicComponent; portIndex: LONGINT; VAR mp: MusicMIDIPacket): ComponentResult;
  637.     {$IFC NOT GENERATINGCFM}
  638.     INLINE $2F3C, $0008, $0027, $7000, $A82A;
  639.     {$ENDC}
  640. FUNCTION MusicReceiveMIDI(mc: MusicComponent; readHook: MusicMIDIReadHookUPP; refCon: LONGINT): ComponentResult;
  641.     {$IFC NOT GENERATINGCFM}
  642.     INLINE $2F3C, $0008, $0028, $7000, $A82A;
  643.     {$ENDC}
  644. FUNCTION MusicStartOffline(mc: MusicComponent; VAR numChannels: LONGINT; VAR sampleRate: UnsignedFixed; VAR sampleSize: INTEGER; dataProc: MusicOfflineDataUPP; dataProcRefCon: LONGINT): ComponentResult;
  645.     {$IFC NOT GENERATINGCFM}
  646.     INLINE $2F3C, $0014, $0029, $7000, $A82A;
  647.     {$ENDC}
  648. FUNCTION MusicSetOfflineTimeTo(mc: MusicComponent; newTimeStamp: LONGINT): ComponentResult;
  649.     {$IFC NOT GENERATINGCFM}
  650.     INLINE $2F3C, $0004, $002A, $7000, $A82A;
  651.     {$ENDC}
  652. FUNCTION MusicGetInstrumentKnobDescription(mc: MusicComponent; knobIndex: LONGINT; VAR mkd: KnobDescription): ComponentResult;
  653.     {$IFC NOT GENERATINGCFM}
  654.     INLINE $2F3C, $0008, $002B, $7000, $A82A;
  655.     {$ENDC}
  656. FUNCTION MusicGetDrumKnobDescription(mc: MusicComponent; knobIndex: LONGINT; VAR mkd: KnobDescription): ComponentResult;
  657.     {$IFC NOT GENERATINGCFM}
  658.     INLINE $2F3C, $0008, $002C, $7000, $A82A;
  659.     {$ENDC}
  660. FUNCTION MusicGetKnobDescription(mc: MusicComponent; knobIndex: LONGINT; VAR mkd: KnobDescription): ComponentResult;
  661.     {$IFC NOT GENERATINGCFM}
  662.     INLINE $2F3C, $0008, $002D, $7000, $A82A;
  663.     {$ENDC}
  664. FUNCTION MusicGetInfoText(mc: MusicComponent; selector: LONGINT; VAR textH: Handle; VAR styleH: Handle): ComponentResult;
  665.     {$IFC NOT GENERATINGCFM}
  666.     INLINE $2F3C, $000C, $002E, $7000, $A82A;
  667.     {$ENDC}
  668.  
  669. CONST
  670.     kGetInstrumentInfoNoBuiltIn    = $01;
  671.     kGetInstrumentInfoMidiUserInst = $02;
  672.     kGetInstrumentInfoNoIText    = $04;
  673.  
  674. FUNCTION MusicGetInstrumentInfo(mc: MusicComponent; getInstrumentInfoFlags: LONGINT; VAR infoListH: InstrumentInfoListHandle): ComponentResult;
  675.     {$IFC NOT GENERATINGCFM}
  676.     INLINE $2F3C, $0008, $002F, $7000, $A82A;
  677.     {$ENDC}
  678. FUNCTION MusicTask(mc: MusicComponent): ComponentResult;
  679.     {$IFC NOT GENERATINGCFM}
  680.     INLINE $2F3C, $0000, $0031, $7000, $A82A;
  681.     {$ENDC}
  682. FUNCTION MusicSetPartInstrumentNumberInterruptSafe(mc: MusicComponent; part: LONGINT; instrumentNumber: LONGINT): ComponentResult;
  683.     {$IFC NOT GENERATINGCFM}
  684.     INLINE $2F3C, $0008, $0032, $7000, $A82A;
  685.     {$ENDC}
  686. FUNCTION MusicSetPartSoundLocalization(mc: MusicComponent; part: LONGINT; data: Handle): ComponentResult;
  687.     {$IFC NOT GENERATINGCFM}
  688.     INLINE $2F3C, $0008, $0033, $7000, $A82A;
  689.     {$ENDC}
  690. FUNCTION MusicGenericConfigure(mc: MusicComponent; mode: LONGINT; flags: LONGINT; baseResID: LONGINT): ComponentResult;
  691.     {$IFC NOT GENERATINGCFM}
  692.     INLINE $2F3C, $000C, $0100, $7000, $A82A;
  693.     {$ENDC}
  694. FUNCTION MusicGenericGetPart(mc: MusicComponent; partNumber: LONGINT; VAR part: GCPartPtr): ComponentResult;
  695.     {$IFC NOT GENERATINGCFM}
  696.     INLINE $2F3C, $0008, $0101, $7000, $A82A;
  697.     {$ENDC}
  698. FUNCTION MusicGenericGetKnobList(mc: MusicComponent; knobType: LONGINT; VAR gkdlH: GenericKnobDescriptionListHandle): ComponentResult;
  699.     {$IFC NOT GENERATINGCFM}
  700.     INLINE $2F3C, $0008, $0102, $7000, $A82A;
  701.     {$ENDC}
  702. FUNCTION MusicDerivedMIDISend(mc: MusicComponent; VAR packet: MusicMIDIPacket): ComponentResult;
  703.     {$IFC NOT GENERATINGCFM}
  704.     INLINE $2F3C, $0004, $0200, $7000, $A82A;
  705.     {$ENDC}
  706. FUNCTION MusicDerivedSetKnob(mc: MusicComponent; knobType: LONGINT; knobNumber: LONGINT; knobValue: LONGINT; partNumber: LONGINT; VAR p: GCPart; VAR gkd: GenericKnobDescription): ComponentResult;
  707.     {$IFC NOT GENERATINGCFM}
  708.     INLINE $2F3C, $0018, $0201, $7000, $A82A;
  709.     {$ENDC}
  710. FUNCTION MusicDerivedSetPart(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart): ComponentResult;
  711.     {$IFC NOT GENERATINGCFM}
  712.     INLINE $2F3C, $0008, $0202, $7000, $A82A;
  713.     {$ENDC}
  714. FUNCTION MusicDerivedSetInstrument(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart): ComponentResult;
  715.     {$IFC NOT GENERATINGCFM}
  716.     INLINE $2F3C, $0008, $0203, $7000, $A82A;
  717.     {$ENDC}
  718. FUNCTION MusicDerivedSetPartInstrumentNumber(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart): ComponentResult;
  719.     {$IFC NOT GENERATINGCFM}
  720.     INLINE $2F3C, $0008, $0204, $7000, $A82A;
  721.     {$ENDC}
  722. FUNCTION MusicDerivedSetMIDI(mc: MusicComponent; midiProc: MusicMIDISendProcPtr; refcon: LONGINT; midiChannel: LONGINT): ComponentResult;
  723.     {$IFC NOT GENERATINGCFM}
  724.     INLINE $2F3C, $000C, $0205, $7000, $A82A;
  725.     {$ENDC}
  726. FUNCTION MusicDerivedStorePartInstrument(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart; instrumentNumber: LONGINT): ComponentResult;
  727.     {$IFC NOT GENERATINGCFM}
  728.     INLINE $2F3C, $000C, $0206, $7000, $A82A;
  729.     {$ENDC}
  730. {  Mask bit for returned value by InstrumentFind. }
  731.  
  732. CONST
  733.     kInstrumentExactMatch        = $00020000;
  734.     kInstrumentRecommendedSubstitute = $00010000;
  735.     kInstrumentQualityField        = $FF000000;
  736.     kInstrumentRoland8BitQuality = $05000000;
  737.  
  738.  
  739. TYPE
  740.     InstrumentAboutInfoHandle            = ^InstrumentAboutInfoPtr;
  741.     GMInstrumentInfoPtr = ^GMInstrumentInfo;
  742.     GMInstrumentInfo = RECORD
  743.         cmpInstID:                LONGINT;
  744.         gmInstNum:                LONGINT;
  745.         instMatch:                LONGINT;
  746.     END;
  747.  
  748.     GMInstrumentInfoHandle                = ^GMInstrumentInfoPtr;
  749.     nonGMInstrumentInfoRecordPtr = ^nonGMInstrumentInfoRecord;
  750.     nonGMInstrumentInfoRecord = RECORD
  751.         cmpInstID:                LONGINT;                                {  if 0, category name }
  752.         flags:                    LONGINT;                                {  match, show in picker }
  753.         toneNameIndex:            LONGINT;                                {  index in toneNames (1 based) }
  754.         itxtNameAtomID:            LONGINT;                                {  index in itxtNames (itxt/name by index) }
  755.     END;
  756.  
  757.     nonGMInstrumentInfoPtr = ^nonGMInstrumentInfo;
  758.     nonGMInstrumentInfo = RECORD
  759.         recordCount:            LONGINT;
  760.         toneNames:                Handle;                                    {  name from tone description }
  761.         itxtNames:                QTAtomContainer;                        {  itext/name atoms for instruments }
  762.         instInfo:                ARRAY [0..0] OF nonGMInstrumentInfoRecord;
  763.     END;
  764.  
  765.     nonGMInstrumentInfoHandle            = ^nonGMInstrumentInfoPtr;
  766.     InstCompInfoPtr = ^InstCompInfo;
  767.     InstCompInfo = RECORD
  768.         infoSize:                LONGINT;                                {  size of this record }
  769.         InstrumentLibraryName:    Str31;
  770.         InstrumentLibraryITxt:    QTAtomContainer;                        {  itext/name atoms for instruments }
  771.         GMinstrumentCount:        LONGINT;
  772.         GMinstrumentInfo:        GMInstrumentInfoHandle;
  773.         GMdrumCount:            LONGINT;
  774.         GMdrumInfo:                GMInstrumentInfoHandle;
  775.         nonGMinstrumentCount:    LONGINT;
  776.         nonGMinstrumentInfo:    nonGMInstrumentInfoHandle;
  777.     END;
  778.  
  779.     InstCompInfoHandle                    = ^InstCompInfoPtr;
  780. FUNCTION InstrumentGetInst(ci: ComponentInstance; instID: LONGINT; VAR atomicInst: AtomicInstrument; flags: LONGINT): ComponentResult;
  781.     {$IFC NOT GENERATINGCFM}
  782.     INLINE $2F3C, $000C, $0001, $7000, $A82A;
  783.     {$ENDC}
  784. FUNCTION InstrumentGetInfo(ci: ComponentInstance; getInstrumentInfoFlags: LONGINT; VAR instInfo: InstCompInfoHandle): ComponentResult;
  785.     {$IFC NOT GENERATINGCFM}
  786.     INLINE $2F3C, $0008, $0002, $7000, $A82A;
  787.     {$ENDC}
  788. FUNCTION InstrumentInitialize(ci: ComponentInstance; initFormat: LONGINT; initParams: UNIV Ptr): ComponentResult;
  789.     {$IFC NOT GENERATINGCFM}
  790.     INLINE $2F3C, $0008, $0003, $7000, $A82A;
  791.     {$ENDC}
  792. FUNCTION InstrumentOpenComponentResFile(ci: ComponentInstance; VAR resFile: INTEGER): ComponentResult;
  793.     {$IFC NOT GENERATINGCFM}
  794.     INLINE $2F3C, $0004, $0004, $7000, $A82A;
  795.     {$ENDC}
  796. FUNCTION InstrumentCloseComponentResFile(ci: ComponentInstance; resFile: INTEGER): ComponentResult;
  797.     {$IFC NOT GENERATINGCFM}
  798.     INLINE $2F3C, $0002, $0005, $7000, $A82A;
  799.     {$ENDC}
  800. FUNCTION InstrumentGetComponentRefCon(ci: ComponentInstance; VAR refCon: UNIV Ptr): ComponentResult;
  801.     {$IFC NOT GENERATINGCFM}
  802.     INLINE $2F3C, $0004, $0006, $7000, $A82A;
  803.     {$ENDC}
  804. FUNCTION InstrumentSetComponentRefCon(ci: ComponentInstance; refCon: UNIV Ptr): ComponentResult;
  805.     {$IFC NOT GENERATINGCFM}
  806.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  807.     {$ENDC}
  808. {
  809. --------------------------
  810.     Types
  811. --------------------------
  812. }
  813.  
  814. CONST
  815.     kSynthesizerConnectionMono    = 1;                            {  if set, and synth can be mono/poly, then the partCount channels from the system channel are hogged  }
  816.     kSynthesizerConnectionMMgr    = 2;                            {  this connection imported from the MIDI Mgr  }
  817.     kSynthesizerConnectionOMS    = 4;                            {  this connection imported from OMS  }
  818.     kSynthesizerConnectionQT    = 8;                            {  this connection is a QuickTime-only port  }
  819.     kSynthesizerConnectionFMS    = 16;                            {  this connection imported from FMS  }
  820.  
  821. {  used for MIDI device only  }
  822.  
  823. TYPE
  824.     SynthesizerConnectionsPtr = ^SynthesizerConnections;
  825.     SynthesizerConnections = RECORD
  826.         clientID:                OSType;
  827.         inputPortID:            OSType;                                    {  terminology death: this port is used to SEND to the midi synth  }
  828.         outputPortID:            OSType;                                    {  terminology death: this port receives from a keyboard or other control device  }
  829.         midiChannel:            LONGINT;                                {  The system channel; others are configurable (or the nubus slot number)  }
  830.         flags:                    LONGINT;
  831.         unique:                    LONGINT;                                {  unique id may be used instead of index, to getinfo and unregister calls  }
  832.         reserved1:                LONGINT;                                {  should be zero  }
  833.         reserved2:                LONGINT;                                {  should be zero  }
  834.     END;
  835.  
  836.     QTMIDIPortPtr = ^QTMIDIPort;
  837.     QTMIDIPort = RECORD
  838.         portConnections:        SynthesizerConnections;
  839.         portName:                Str63;
  840.     END;
  841.  
  842.  
  843. CONST
  844.     kNoteRequestNoGM            = 1;                            {  dont degrade to a GM synth  }
  845.     kNoteRequestNoSynthType        = 2;                            {  dont degrade to another synth of same type but different name  }
  846.     kNoteRequestSynthMustMatch    = 4;                            {  synthType must be a match, including kGMSynthComponentSubType  }
  847.  
  848.  
  849. TYPE
  850.     NoteAllocator                        = ComponentInstance;
  851.     NoteRequestInfoPtr = ^NoteRequestInfo;
  852.     NoteRequestInfo = RECORD
  853.         flags:                    SInt8;                                    {  1: dont accept GM match, 2: dont accept same-synth-type match  }
  854.         reserved:                SInt8;                                    {  must be zero  }
  855.         polyphony:                INTEGER;                                {  Maximum number of voices  }
  856.         typicalPolyphony:        Fixed;                                    {  Hint for level mixing  }
  857.     END;
  858.  
  859.     NoteRequestPtr = ^NoteRequest;
  860.     NoteRequest = RECORD
  861.         info:                    NoteRequestInfo;
  862.         tone:                    ToneDescription;
  863.     END;
  864.  
  865.     NoteChannel = ^LONGINT;
  866.  
  867. CONST
  868.     kPickDontMix                = 1;                            {  dont mix instruments with drum sounds  }
  869.     kPickSameSynth                = 2;                            {  only allow the same device that went in, to come out  }
  870.     kPickUserInsts                = 4;                            {  show user insts in addition to ROM voices  }
  871.     kPickEditAllowEdit            = 8;                            {  lets user switch over to edit mode  }
  872.     kPickEditAllowPick            = 16;                            {  lets the user switch over to pick mode  }
  873.     kPickEditSynthGlobal        = 32;                            {  edit the global knobs of the synth  }
  874.     kPickEditControllers        = 64;                            {  edit the controllers of the notechannel  }
  875.  
  876.     kNoteAllocatorComponentType    = 'nota';
  877.  
  878. {
  879. --------------------------------
  880.     Note Allocator Prototypes
  881. --------------------------------
  882. }
  883. FUNCTION NARegisterMusicDevice(ci: NoteAllocator; synthType: OSType; VAR name: Str31; VAR connections: SynthesizerConnections): ComponentResult;
  884.     {$IFC NOT GENERATINGCFM}
  885.     INLINE $2F3C, $000C, $0000, $7000, $A82A;
  886.     {$ENDC}
  887. FUNCTION NAUnregisterMusicDevice(ci: NoteAllocator; index: LONGINT): ComponentResult;
  888.     {$IFC NOT GENERATINGCFM}
  889.     INLINE $2F3C, $0004, $0001, $7000, $A82A;
  890.     {$ENDC}
  891. FUNCTION NAGetRegisteredMusicDevice(ci: NoteAllocator; index: LONGINT; VAR synthType: OSType; VAR name: Str31; VAR connections: SynthesizerConnections; VAR mc: MusicComponent): ComponentResult;
  892.     {$IFC NOT GENERATINGCFM}
  893.     INLINE $2F3C, $0014, $0002, $7000, $A82A;
  894.     {$ENDC}
  895. FUNCTION NASaveMusicConfiguration(ci: NoteAllocator): ComponentResult;
  896.     {$IFC NOT GENERATINGCFM}
  897.     INLINE $2F3C, $0000, $0003, $7000, $A82A;
  898.     {$ENDC}
  899. FUNCTION NANewNoteChannel(ci: NoteAllocator; VAR noteRequest: NoteRequest; VAR outChannel: NoteChannel): ComponentResult;
  900.     {$IFC NOT GENERATINGCFM}
  901.     INLINE $2F3C, $0008, $0004, $7000, $A82A;
  902.     {$ENDC}
  903. FUNCTION NADisposeNoteChannel(ci: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  904.     {$IFC NOT GENERATINGCFM}
  905.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  906.     {$ENDC}
  907. FUNCTION NAGetNoteChannelInfo(ci: NoteAllocator; noteChannel: NoteChannel; VAR index: LONGINT; VAR part: LONGINT): ComponentResult;
  908.     {$IFC NOT GENERATINGCFM}
  909.     INLINE $2F3C, $000C, $0006, $7000, $A82A;
  910.     {$ENDC}
  911. FUNCTION NAPrerollNoteChannel(ci: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  912.     {$IFC NOT GENERATINGCFM}
  913.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  914.     {$ENDC}
  915. FUNCTION NAUnrollNoteChannel(ci: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  916.     {$IFC NOT GENERATINGCFM}
  917.     INLINE $2F3C, $0004, $0008, $7000, $A82A;
  918.     {$ENDC}
  919. FUNCTION NASetNoteChannelVolume(ci: NoteAllocator; noteChannel: NoteChannel; volume: Fixed): ComponentResult;
  920.     {$IFC NOT GENERATINGCFM}
  921.     INLINE $2F3C, $0008, $000B, $7000, $A82A;
  922.     {$ENDC}
  923. FUNCTION NAResetNoteChannel(ci: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  924.     {$IFC NOT GENERATINGCFM}
  925.     INLINE $2F3C, $0004, $000C, $7000, $A82A;
  926.     {$ENDC}
  927. FUNCTION NAPlayNote(ci: NoteAllocator; noteChannel: NoteChannel; pitch: LONGINT; velocity: LONGINT): ComponentResult;
  928.     {$IFC NOT GENERATINGCFM}
  929.     INLINE $2F3C, $000C, $000D, $7000, $A82A;
  930.     {$ENDC}
  931. FUNCTION NASetController(ci: NoteAllocator; noteChannel: NoteChannel; controllerNumber: LONGINT; controllerValue: LONGINT): ComponentResult;
  932.     {$IFC NOT GENERATINGCFM}
  933.     INLINE $2F3C, $000C, $000E, $7000, $A82A;
  934.     {$ENDC}
  935. FUNCTION NASetKnob(ci: NoteAllocator; noteChannel: NoteChannel; knobNumber: LONGINT; knobValue: LONGINT): ComponentResult;
  936.     {$IFC NOT GENERATINGCFM}
  937.     INLINE $2F3C, $000C, $000F, $7000, $A82A;
  938.     {$ENDC}
  939. FUNCTION NAFindNoteChannelTone(ci: NoteAllocator; noteChannel: NoteChannel; VAR td: ToneDescription; VAR instrumentNumber: LONGINT): ComponentResult;
  940.     {$IFC NOT GENERATINGCFM}
  941.     INLINE $2F3C, $000C, $0010, $7000, $A82A;
  942.     {$ENDC}
  943. FUNCTION NASetInstrumentNumber(ci: NoteAllocator; noteChannel: NoteChannel; instrumentNumber: LONGINT): ComponentResult;
  944.     {$IFC NOT GENERATINGCFM}
  945.     INLINE $2F3C, $0008, $0011, $7000, $A82A;
  946.     {$ENDC}
  947. FUNCTION NAPickInstrument(ci: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; VAR sd: ToneDescription; flags: LONGINT; refCon: LONGINT; reserved1: LONGINT; reserved2: LONGINT): ComponentResult;
  948.     {$IFC NOT GENERATINGCFM}
  949.     INLINE $2F3C, $001C, $0012, $7000, $A82A;
  950.     {$ENDC}
  951. FUNCTION NAPickArrangement(ci: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; zero1: LONGINT; zero2: LONGINT; t: Track; songName: StringPtr): ComponentResult;
  952.     {$IFC NOT GENERATINGCFM}
  953.     INLINE $2F3C, $0018, $0013, $7000, $A82A;
  954.     {$ENDC}
  955. FUNCTION NASetDefaultMIDIInput(ci: NoteAllocator; VAR sc: SynthesizerConnections): ComponentResult;
  956.     {$IFC NOT GENERATINGCFM}
  957.     INLINE $2F3C, $0004, $0015, $7000, $A82A;
  958.     {$ENDC}
  959. FUNCTION NAGetDefaultMIDIInput(ci: NoteAllocator; VAR sc: SynthesizerConnections): ComponentResult;
  960.     {$IFC NOT GENERATINGCFM}
  961.     INLINE $2F3C, $0004, $0016, $7000, $A82A;
  962.     {$ENDC}
  963. FUNCTION NAUseDefaultMIDIInput(ci: NoteAllocator; readHook: MusicMIDIReadHookUPP; refCon: LONGINT; flags: LONGINT): ComponentResult;
  964.     {$IFC NOT GENERATINGCFM}
  965.     INLINE $2F3C, $000C, $0019, $7000, $A82A;
  966.     {$ENDC}
  967. FUNCTION NALoseDefaultMIDIInput(ci: NoteAllocator): ComponentResult;
  968.     {$IFC NOT GENERATINGCFM}
  969.     INLINE $2F3C, $0000, $001A, $7000, $A82A;
  970.     {$ENDC}
  971. FUNCTION NAStuffToneDescription(ci: NoteAllocator; gmNumber: LONGINT; VAR td: ToneDescription): ComponentResult;
  972.     {$IFC NOT GENERATINGCFM}
  973.     INLINE $2F3C, $0008, $001B, $7000, $A82A;
  974.     {$ENDC}
  975. FUNCTION NACopyrightDialog(ci: NoteAllocator; p: PicHandle; author: StringPtr; copyright: StringPtr; other: StringPtr; title: StringPtr; filterProc: ModalFilterUPP; refCon: LONGINT): ComponentResult;
  976.     {$IFC NOT GENERATINGCFM}
  977.     INLINE $2F3C, $001C, $001C, $7000, $A82A;
  978.     {$ENDC}
  979. {
  980.     kNADummyOneSelect = 29
  981.     kNADummyTwoSelect = 30
  982. }
  983. FUNCTION NAGetIndNoteChannel(ci: NoteAllocator; index: LONGINT; VAR nc: NoteChannel; VAR seed: LONGINT): ComponentResult;
  984.     {$IFC NOT GENERATINGCFM}
  985.     INLINE $2F3C, $000C, $001F, $7000, $A82A;
  986.     {$ENDC}
  987. FUNCTION NAGetMIDIPorts(ci: NoteAllocator; VAR inputPorts: Handle; VAR outputPorts: Handle): ComponentResult;
  988.     {$IFC NOT GENERATINGCFM}
  989.     INLINE $2F3C, $0008, $0021, $7000, $A82A;
  990.     {$ENDC}
  991. FUNCTION NAGetNoteRequest(ci: NoteAllocator; noteChannel: NoteChannel; VAR nrOut: NoteRequest): ComponentResult;
  992.     {$IFC NOT GENERATINGCFM}
  993.     INLINE $2F3C, $0008, $0022, $7000, $A82A;
  994.     {$ENDC}
  995. FUNCTION NASendMIDI(ci: NoteAllocator; noteChannel: NoteChannel; VAR mp: MusicMIDIPacket): ComponentResult;
  996.     {$IFC NOT GENERATINGCFM}
  997.     INLINE $2F3C, $0008, $0023, $7000, $A82A;
  998.     {$ENDC}
  999. FUNCTION NAPickEditInstrument(ci: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; refCon: LONGINT; nc: NoteChannel; ai: AtomicInstrument; flags: LONGINT): ComponentResult;
  1000.     {$IFC NOT GENERATINGCFM}
  1001.     INLINE $2F3C, $0018, $0024, $7000, $A82A;
  1002.     {$ENDC}
  1003. FUNCTION NANewNoteChannelFromAtomicInstrument(ci: NoteAllocator; instrument: AtomicInstrumentPtr; flags: LONGINT; VAR outChannel: NoteChannel): ComponentResult;
  1004.     {$IFC NOT GENERATINGCFM}
  1005.     INLINE $2F3C, $000C, $0025, $7000, $A82A;
  1006.     {$ENDC}
  1007. FUNCTION NASetAtomicInstrument(ci: NoteAllocator; noteChannel: NoteChannel; instrument: AtomicInstrumentPtr; flags: LONGINT): ComponentResult;
  1008.     {$IFC NOT GENERATINGCFM}
  1009.     INLINE $2F3C, $000C, $0026, $7000, $A82A;
  1010.     {$ENDC}
  1011. FUNCTION NAGetKnob(ci: NoteAllocator; noteChannel: NoteChannel; knobNumber: LONGINT; VAR knobValue: LONGINT): ComponentResult;
  1012.     {$IFC NOT GENERATINGCFM}
  1013.     INLINE $2F3C, $000C, $0028, $7000, $A82A;
  1014.     {$ENDC}
  1015. FUNCTION NATask(ci: NoteAllocator): ComponentResult;
  1016.     {$IFC NOT GENERATINGCFM}
  1017.     INLINE $2F3C, $0000, $0029, $7000, $A82A;
  1018.     {$ENDC}
  1019. FUNCTION NASetNoteChannelBalance(ci: NoteAllocator; noteChannel: NoteChannel; balance: LONGINT): ComponentResult;
  1020.     {$IFC NOT GENERATINGCFM}
  1021.     INLINE $2F3C, $0008, $002A, $7000, $A82A;
  1022.     {$ENDC}
  1023. FUNCTION NASetInstrumentNumberInterruptSafe(ci: NoteAllocator; noteChannel: NoteChannel; instrumentNumber: LONGINT): ComponentResult;
  1024.     {$IFC NOT GENERATINGCFM}
  1025.     INLINE $2F3C, $0008, $002B, $7000, $A82A;
  1026.     {$ENDC}
  1027. FUNCTION NASetNoteChannelSoundLocalization(ci: NoteAllocator; noteChannel: NoteChannel; data: Handle): ComponentResult;
  1028.     {$IFC NOT GENERATINGCFM}
  1029.     INLINE $2F3C, $0008, $002C, $7000, $A82A;
  1030.     {$ENDC}
  1031.  
  1032. CONST
  1033.     kTuneQueueDepth                = 8;                            {  Deepest you can queue tune segments  }
  1034.  
  1035.  
  1036. TYPE
  1037.     TuneStatusPtr = ^TuneStatus;
  1038.     TuneStatus = RECORD
  1039.         tune:                    LongintPtr;                                {  currently playing tune  }
  1040.         tunePtr:                LongintPtr;                                {  position within currently playing piece  }
  1041.         time:                    TimeValue;                                {  current tune time  }
  1042.         queueCount:                INTEGER;                                {  how many pieces queued up?  }
  1043.         queueSpots:                INTEGER;                                {  How many more tunepieces can be queued  }
  1044.         queueTime:                TimeValue;                                {  How much time is queued up? (can be very inaccurate)  }
  1045.         reserved:                ARRAY [0..2] OF LONGINT;
  1046.     END;
  1047.  
  1048.     TuneCallBackProcPtr = ProcPtr;  { PROCEDURE TuneCallBack((CONST)VAR status: TuneStatus; refCon: LONGINT); }
  1049.  
  1050.     TunePlayCallBackProcPtr = ProcPtr;  { PROCEDURE TunePlayCallBack(VAR event: LONGINT; seed: LONGINT; refCon: LONGINT); }
  1051.  
  1052.     TuneCallBackUPP = UniversalProcPtr;
  1053.     TunePlayCallBackUPP = UniversalProcPtr;
  1054.     TunePlayer                            = ComponentInstance;
  1055.  
  1056. CONST
  1057.     kTunePlayerType                = 'tune';
  1058.  
  1059. FUNCTION TuneSetHeader(tp: TunePlayer; VAR header: LONGINT): ComponentResult;
  1060.     {$IFC NOT GENERATINGCFM}
  1061.     INLINE $2F3C, $0004, $0004, $7000, $A82A;
  1062.     {$ENDC}
  1063. FUNCTION TuneGetTimeBase(tp: TunePlayer; VAR tb: TimeBase): ComponentResult;
  1064.     {$IFC NOT GENERATINGCFM}
  1065.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  1066.     {$ENDC}
  1067. FUNCTION TuneSetTimeScale(tp: TunePlayer; scale: TimeScale): ComponentResult;
  1068.     {$IFC NOT GENERATINGCFM}
  1069.     INLINE $2F3C, $0004, $0006, $7000, $A82A;
  1070.     {$ENDC}
  1071. FUNCTION TuneGetTimeScale(tp: TunePlayer; VAR scale: TimeScale): ComponentResult;
  1072.     {$IFC NOT GENERATINGCFM}
  1073.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  1074.     {$ENDC}
  1075. FUNCTION TuneGetIndexedNoteChannel(tp: TunePlayer; i: LONGINT; VAR nc: NoteChannel): ComponentResult;
  1076.     {$IFC NOT GENERATINGCFM}
  1077.     INLINE $2F3C, $0008, $0008, $7000, $A82A;
  1078.     {$ENDC}
  1079. {  Values for when to start.  }
  1080.  
  1081. CONST
  1082.     kTuneStartNow                = 1;                            {  start after buffer is implied  }
  1083.     kTuneDontClipNotes            = 2;                            {  allow notes to finish their durations outside sample  }
  1084.     kTuneExcludeEdgeNotes        = 4;                            {  dont play notes that start at end of tune  }
  1085.     kTuneQuickStart                = 8;                            {  Leave all the controllers where they are, ignore start time  }
  1086.     kTuneLoopUntil                = 16;                            {  loop a queued tune if there's nothing else in the queue  }
  1087.     kTuneStartNewMaster            = 16384;
  1088.  
  1089. FUNCTION TuneQueue(tp: TunePlayer; VAR tune: LONGINT; tuneRate: Fixed; tuneStartPosition: LONGINT; tuneStopPosition: LONGINT; queueFlags: LONGINT; callBackProc: TuneCallBackUPP; refCon: LONGINT): ComponentResult;
  1090.     {$IFC NOT GENERATINGCFM}
  1091.     INLINE $2F3C, $001C, $000A, $7000, $A82A;
  1092.     {$ENDC}
  1093. FUNCTION TuneInstant(tp: TunePlayer; tune: UNIV Ptr; tunePosition: LONGINT): ComponentResult;
  1094.     {$IFC NOT GENERATINGCFM}
  1095.     INLINE $2F3C, $0008, $000B, $7000, $A82A;
  1096.     {$ENDC}
  1097. FUNCTION TuneGetStatus(tp: TunePlayer; VAR status: TuneStatus): ComponentResult;
  1098.     {$IFC NOT GENERATINGCFM}
  1099.     INLINE $2F3C, $0004, $000C, $7000, $A82A;
  1100.     {$ENDC}
  1101. {  Values for stopping.  }
  1102.  
  1103. CONST
  1104.     kTuneStopFade                = 1;                            {  do a quick, synchronous fadeout  }
  1105.     kTuneStopSustain            = 2;                            {  don't silece notes  }
  1106.     kTuneStopInstant            = 4;                            {  silence notes fast (else, decay them)  }
  1107.     kTuneStopReleaseChannels    = 8;                            {  afterwards, let the channels go  }
  1108.  
  1109. FUNCTION TuneStop(tp: TunePlayer; stopFlags: LONGINT): ComponentResult;
  1110.     {$IFC NOT GENERATINGCFM}
  1111.     INLINE $2F3C, $0004, $000D, $7000, $A82A;
  1112.     {$ENDC}
  1113. FUNCTION TuneSetVolume(tp: TunePlayer; volume: Fixed): ComponentResult;
  1114.     {$IFC NOT GENERATINGCFM}
  1115.     INLINE $2F3C, $0004, $0010, $7000, $A82A;
  1116.     {$ENDC}
  1117. FUNCTION TuneGetVolume(tp: TunePlayer): ComponentResult;
  1118.     {$IFC NOT GENERATINGCFM}
  1119.     INLINE $2F3C, $0000, $0011, $7000, $A82A;
  1120.     {$ENDC}
  1121. FUNCTION TunePreroll(tp: TunePlayer): ComponentResult;
  1122.     {$IFC NOT GENERATINGCFM}
  1123.     INLINE $2F3C, $0000, $0012, $7000, $A82A;
  1124.     {$ENDC}
  1125. FUNCTION TuneUnroll(tp: TunePlayer): ComponentResult;
  1126.     {$IFC NOT GENERATINGCFM}
  1127.     INLINE $2F3C, $0000, $0013, $7000, $A82A;
  1128.     {$ENDC}
  1129. FUNCTION TuneSetNoteChannels(tp: TunePlayer; count: LONGINT; VAR noteChannelList: NoteChannel; playCallBackProc: TunePlayCallBackUPP; refCon: LONGINT): ComponentResult;
  1130.     {$IFC NOT GENERATINGCFM}
  1131.     INLINE $2F3C, $0010, $0014, $7000, $A82A;
  1132.     {$ENDC}
  1133. FUNCTION TuneSetPartTranspose(tp: TunePlayer; part: LONGINT; transpose: LONGINT; velocityShift: LONGINT): ComponentResult;
  1134.     {$IFC NOT GENERATINGCFM}
  1135.     INLINE $2F3C, $000C, $0015, $7000, $A82A;
  1136.     {$ENDC}
  1137. FUNCTION TuneGetNoteAllocator(tp: TunePlayer): NoteAllocator;
  1138.     {$IFC NOT GENERATINGCFM}
  1139.     INLINE $2F3C, $0000, $0017, $7000, $A82A;
  1140.     {$ENDC}
  1141. FUNCTION TuneSetSofter(tp: TunePlayer; softer: LONGINT): ComponentResult;
  1142.     {$IFC NOT GENERATINGCFM}
  1143.     INLINE $2F3C, $0004, $0018, $7000, $A82A;
  1144.     {$ENDC}
  1145. FUNCTION TuneTask(tp: TunePlayer): ComponentResult;
  1146.     {$IFC NOT GENERATINGCFM}
  1147.     INLINE $2F3C, $0000, $0019, $7000, $A82A;
  1148.     {$ENDC}
  1149. FUNCTION TuneSetBalance(tp: TunePlayer; balance: LONGINT): ComponentResult;
  1150.     {$IFC NOT GENERATINGCFM}
  1151.     INLINE $2F3C, $0004, $001A, $7000, $A82A;
  1152.     {$ENDC}
  1153. FUNCTION TuneSetSoundLocalization(tp: TunePlayer; data: Handle): ComponentResult;
  1154.     {$IFC NOT GENERATINGCFM}
  1155.     INLINE $2F3C, $0004, $001B, $7000, $A82A;
  1156.     {$ENDC}
  1157. FUNCTION TuneSetHeaderWithSize(tp: TunePlayer; VAR header: LONGINT; size: LONGINT): ComponentResult;
  1158.     {$IFC NOT GENERATINGCFM}
  1159.     INLINE $2F3C, $0008, $001C, $7000, $A82A;
  1160.     {$ENDC}
  1161.  
  1162. TYPE
  1163.     MusicOpWord                            = LONGINT;
  1164.     MusicOpWordPtr                        = ^LONGINT;
  1165. {
  1166.      QuickTime Music Track Event Formats:
  1167.  
  1168.     At this time, QuickTime music tracks support 5 different event types -- REST events,
  1169.     short NOTE events, short CONTROL events, short GENERAL events, Long NOTE events, 
  1170.     long CONTROL events, and variable GENERAL events.
  1171.  
  1172.         • REST Event (4 bytes/event):
  1173.     
  1174.             (0 0 0) (5-bit UNUSED) (24-bit Rest Duration)
  1175.         
  1176.         • Short NOTE Events (4 bytes/event):
  1177.     
  1178.             (0 0 1) (5-bit Part) (6-bit Pitch) (7-bit Volume) (11-bit Duration)
  1179.         
  1180.             where:    Pitch is offset by 32 (Actual pitch = pitch field + 32)
  1181.  
  1182.         • Short CONTROL Events (4 bytes/event):
  1183.     
  1184.             (0 1 0) (5-bit Part) (8-bit Controller) (1-bit UNUSED) (1-bit Sign) (7-bit MSB) (7-bit LSB)
  1185.                                                                          ( or 15-bit Signed Value)
  1186.         • Short GENERAL Event (4 bytes/event):
  1187.     
  1188.             (0 1 1) (1-bit UNUSED) (12-bit Sub-Type) (16-bit Value)
  1189.     
  1190.         • Long NOTE Events (8 bytes/event):
  1191.     
  1192.             (1 0 0 1) (12-bit Part) (1-bit UNUSED) (7-bit Pitch) (1-bit UNUSED) (7-bit Volume)
  1193.             (1 0) (8-bit UNUSED) (22-bit Duration)
  1194.         
  1195.         • Long CONTROL Event (8 bytes/event):
  1196.         
  1197.             (1 0 1 0) (12-bit Part) (16-bit Value MSB) 
  1198.             (1 0) (14-bit Controller) (16-bit Value LSB)
  1199.     
  1200.         • Long KNOB Event (8 bytes/event):
  1201.     
  1202.             (1 0 1 1) (12-bit Sub-Type) (16-bit Value MSB)
  1203.             (1 0) (14-bit KNOB) (16-bit Value LSB)
  1204.     
  1205.         • Variable GENERAL Length Events (N bytes/event):
  1206.     
  1207.             (1 1 1 1) (12-bit Sub-Type) (16-bit Length)
  1208.                 :
  1209.             (32-bit Data values)
  1210.                 :
  1211.             (1 1) (14-bit UNUSED) (16-bit Length)
  1212.     
  1213.             where:    Length field is the number of LONG words in the record.
  1214.                     Lengths include the first and last long words (Minimum length = 2)
  1215.                 
  1216.     The following event type values have not been used yet and are reserved for 
  1217.     future expansion:
  1218.         
  1219.         • (1 0 0 0)        (8 bytes/event)
  1220.         • (1 1 0 0)        (N bytes/event)
  1221.         • (1 1 0 1)        (N bytes/event)
  1222.         • (1 1 1 0)        (N bytes/event)
  1223.         
  1224.     For all events, the following generalizations apply:
  1225.     
  1226.         -    All duration values are specified in Millisecond units.
  1227.         -     Pitch values are intended to map directly to the MIDI key numbers.
  1228.         -    Controllers from 0 to 127 correspond to the standard MIDI controllers.
  1229.             Controllers greater than 127 correspond to other controls (i.e., Pitch Bend, 
  1230.             Key Pressure, and Channel Pressure).    
  1231. }
  1232. {  Defines for the implemented music event data fields }
  1233.  
  1234. CONST
  1235.     kRestEventType                = $00000000;                    {  lower 3-bits  }
  1236.     kNoteEventType                = $00000001;                    {  lower 3-bits  }
  1237.     kControlEventType            = $00000002;                    {  lower 3-bits  }
  1238.     kMarkerEventType            = $00000003;                    {  lower 3-bits  }
  1239.     kUndefined1EventType        = $00000008;                    {  4-bits  }
  1240.     kXNoteEventType                = $00000009;                    {  4-bits  }
  1241.     kXControlEventType            = $0000000A;                    {  4-bits  }
  1242.     kKnobEventType                = $0000000B;                    {  4-bits  }
  1243.     kUndefined2EventType        = $0000000C;                    {  4-bits  }
  1244.     kUndefined3EventType        = $0000000D;                    {  4-bits  }
  1245.     kUndefined4EventType        = $0000000E;                    {  4-bits  }
  1246.     kGeneralEventType            = $0000000F;                    {  4-bits  }
  1247.     kXEventLengthBits            = $00000002;                    {  2 bits: indicates 8-byte event record  }
  1248.     kGeneralEventLengthBits        = $00000003;                    {  2 bits: indicates variable length event record  }
  1249.     kEventLen                    = 1;                            {  length of events in long words  }
  1250.     kXEventLen                    = 2;
  1251.     kRestEventLen                = 1;                            {  length of events in long words  }
  1252.     kNoteEventLen                = 1;
  1253.     kControlEventLen            = 1;
  1254.     kMarkerEventLen                = 1;
  1255.     kXNoteEventLen                = 2;
  1256.     kXControlEventLen            = 2;
  1257.     kGeneralEventLen            = 2;                            {  2 or more, however  }
  1258.                                                                 {  Universal Event Defines }
  1259.     kEventLengthFieldPos        = 30;                            {  by looking at these two bits of the 1st or last word               }
  1260.     kEventLengthFieldWidth        = 2;                            {  of an event you can determine the event length                       }
  1261.                                                                 {  length field: 0 & 1 => 1 long; 2 => 2 longs; 3 => variable length  }
  1262.     kEventTypeFieldPos            = 29;                            {  event type field for short events  }
  1263.     kEventTypeFieldWidth        = 3;                            {  short type is 3 bits  }
  1264.     kXEventTypeFieldPos            = 28;                            {  event type field for extended events  }
  1265.     kXEventTypeFieldWidth        = 4;                            {  extended type is 4 bits  }
  1266.     kEventPartFieldPos            = 24;
  1267.     kEventPartFieldWidth        = 5;
  1268.     kXEventPartFieldPos            = 16;                            {  in the 1st long word  }
  1269.     kXEventPartFieldWidth        = 12;                            {  Rest Events }
  1270.     kRestEventDurationFieldPos    = 0;
  1271.     kRestEventDurationFieldWidth = 24;
  1272.     kRestEventDurationMax        = $00FFFFFF;                    {  Note Events }
  1273.     kNoteEventPitchFieldPos        = 18;
  1274.     kNoteEventPitchFieldWidth    = 6;
  1275.     kNoteEventPitchOffset        = 32;                            {  add to value in pitch field to get actual pitch  }
  1276.     kNoteEventVolumeFieldPos    = 11;
  1277.     kNoteEventVolumeFieldWidth    = 7;
  1278.     kNoteEventVolumeOffset        = 0;                            {  add to value in volume field to get actual volume  }
  1279.     kNoteEventDurationFieldPos    = 0;
  1280.     kNoteEventDurationFieldWidth = 11;
  1281.     kNoteEventDurationMax        = $000007FF;
  1282.     kXNoteEventPitchFieldPos    = 0;                            {  in the 1st long word  }
  1283.     kXNoteEventPitchFieldWidth    = 16;
  1284.     kXNoteEventDurationFieldPos    = 0;                            {  in the 2nd long word  }
  1285.     kXNoteEventDurationFieldWidth = 22;
  1286.     kXNoteEventDurationMax        = $003FFFFF;
  1287.     kXNoteEventVolumeFieldPos    = 22;                            {  in the 2nd long word  }
  1288.     kXNoteEventVolumeFieldWidth    = 7;                            {  Control Events }
  1289.     kControlEventControllerFieldPos = 16;
  1290.     kControlEventControllerFieldWidth = 8;
  1291.     kControlEventValueFieldPos    = 0;
  1292.     kControlEventValueFieldWidth = 16;
  1293.     kXControlEventControllerFieldPos = 0;                        {  in the 2nd long word  }
  1294.     kXControlEventControllerFieldWidth = 16;
  1295.     kXControlEventValueFieldPos    = 0;                            {  in the 1st long word  }
  1296.     kXControlEventValueFieldWidth = 16;                            {  Knob Events }
  1297.     kKnobEventValueHighFieldPos    = 0;                            {  1st long word  }
  1298.     kKnobEventValueHighFieldWidth = 16;
  1299.     kKnobEventKnobFieldPos        = 16;                            {  2nd long word  }
  1300.     kKnobEventKnobFieldWidth    = 14;
  1301.     kKnobEventValueLowFieldPos    = 0;                            {  2nd long word  }
  1302.     kKnobEventValueLowFieldWidth = 16;                            {  Marker Events }
  1303.     kMarkerEventSubtypeFieldPos    = 16;
  1304.     kMarkerEventSubtypeFieldWidth = 8;
  1305.     kMarkerEventValueFieldPos    = 0;
  1306.     kMarkerEventValueFieldWidth    = 16;                            {  General Events }
  1307.     kGeneralEventSubtypeFieldPos = 16;                            {  in the last long word  }
  1308.     kGeneralEventSubtypeFieldWidth = 14;
  1309.     kGeneralEventLengthFieldPos    = 0;                            {  in the 1st & last long words  }
  1310.     kGeneralEventLengthFieldWidth = 16;
  1311.  
  1312. {  General Event Defined Types }
  1313.     kGeneralEventNoteRequest    = 1;                            {  Encapsulates NoteRequest data structure  }
  1314.     kGeneralEventPartKey        = 4;
  1315.     kGeneralEventTuneDifference    = 5;                            {  Contains a standard sequence, with end marker, for the tune difference of a sequence piece (halts QuickTime 2.0 Music)  }
  1316.     kGeneralEventAtomicInstrument = 6;                            {  Encapsulates AtomicInstrument record  }
  1317.     kGeneralEventKnob            = 7;                            {  knobID/knobValue pairs; smallest event is 4 longs  }
  1318.     kGeneralEventMIDIChannel    = 8;                            {  used in tune header, one longword identifies the midi channel it originally came from  }
  1319.     kGeneralEventPartChange        = 9;                            {  used in tune sequence, one longword identifies the tune part which can now take over this part's note channel (similar to program change) (halts QuickTime 2.0 Music) }
  1320.     kGeneralEventNoOp            = 10;                            {  guaranteed to do nothing and be ignored. (halts QuickTime 2.0 Music)  }
  1321.     kGeneralEventUsedNotes        = 11;                            {  four longwords specifying which midi notes are actually used, 0..127 msb to lsb  }
  1322.  
  1323. {  Marker Event Defined Types        // marker is 60 ee vv vv in hex, where e = event type, and v = value }
  1324.     kMarkerEventEnd                = 0;                            {  marker type 0 means: value 0 - stop, value != 0 - ignore }
  1325.     kMarkerEventBeat            = 1;                            {  value 0 = single beat; anything else is 65536ths-of-a-beat (quarter note) }
  1326.     kMarkerEventTempo            = 2;                            {  value same as beat marker, but indicates that a tempo event should be computed (based on where the next beat or tempo marker is) and emitted upon export }
  1327.  
  1328. {  UPP call backs  }
  1329.     uppMusicMIDISendProcInfo = $00000FF0;
  1330.     uppMusicMIDIReadHookProcInfo = $000003F0;
  1331.     uppMusicOfflineDataProcInfo = $00000FF0;
  1332.     uppTuneCallBackProcInfo = $000003C0;
  1333.     uppTunePlayCallBackProcInfo = $00000FC0;
  1334.  
  1335. FUNCTION NewMusicMIDISendProc(userRoutine: MusicMIDISendProcPtr): MusicMIDISendUPP;
  1336.     {$IFC NOT GENERATINGCFM }
  1337.     INLINE $2E9F;
  1338.     {$ENDC}
  1339.  
  1340. FUNCTION NewMusicMIDIReadHookProc(userRoutine: MusicMIDIReadHookProcPtr): MusicMIDIReadHookUPP;
  1341.     {$IFC NOT GENERATINGCFM }
  1342.     INLINE $2E9F;
  1343.     {$ENDC}
  1344.  
  1345. FUNCTION NewMusicOfflineDataProc(userRoutine: MusicOfflineDataProcPtr): MusicOfflineDataUPP;
  1346.     {$IFC NOT GENERATINGCFM }
  1347.     INLINE $2E9F;
  1348.     {$ENDC}
  1349.  
  1350. FUNCTION NewTuneCallBackProc(userRoutine: TuneCallBackProcPtr): TuneCallBackUPP;
  1351.     {$IFC NOT GENERATINGCFM }
  1352.     INLINE $2E9F;
  1353.     {$ENDC}
  1354.  
  1355. FUNCTION NewTunePlayCallBackProc(userRoutine: TunePlayCallBackProcPtr): TunePlayCallBackUPP;
  1356.     {$IFC NOT GENERATINGCFM }
  1357.     INLINE $2E9F;
  1358.     {$ENDC}
  1359.  
  1360. FUNCTION CallMusicMIDISendProc(self: MusicComponent; refCon: LONGINT; VAR mmp: MusicMIDIPacket; userRoutine: MusicMIDISendUPP): ComponentResult;
  1361.     {$IFC NOT GENERATINGCFM}
  1362.     INLINE $205F, $4E90;
  1363.     {$ENDC}
  1364.  
  1365. FUNCTION CallMusicMIDIReadHookProc(VAR mp: MusicMIDIPacket; myRefCon: LONGINT; userRoutine: MusicMIDIReadHookUPP): ComponentResult;
  1366.     {$IFC NOT GENERATINGCFM}
  1367.     INLINE $205F, $4E90;
  1368.     {$ENDC}
  1369.  
  1370. FUNCTION CallMusicOfflineDataProc(SoundData: Ptr; numBytes: LONGINT; myRefCon: LONGINT; userRoutine: MusicOfflineDataUPP): ComponentResult;
  1371.     {$IFC NOT GENERATINGCFM}
  1372.     INLINE $205F, $4E90;
  1373.     {$ENDC}
  1374.  
  1375. PROCEDURE CallTuneCallBackProc({CONST}VAR status: TuneStatus; refCon: LONGINT; userRoutine: TuneCallBackUPP);
  1376.     {$IFC NOT GENERATINGCFM}
  1377.     INLINE $205F, $4E90;
  1378.     {$ENDC}
  1379.  
  1380. PROCEDURE CallTunePlayCallBackProc(VAR event: LONGINT; seed: LONGINT; refCon: LONGINT; userRoutine: TunePlayCallBackUPP);
  1381.     {$IFC NOT GENERATINGCFM}
  1382.     INLINE $205F, $4E90;
  1383.     {$ENDC}
  1384. {$ALIGN RESET}
  1385. {$POP}
  1386.  
  1387. {$SETC UsingIncludes := QuickTimeMusicIncludes}
  1388.  
  1389. {$ENDC} {__QUICKTIMEMUSIC__}
  1390.  
  1391. {$IFC NOT UsingIncludes}
  1392.  END.
  1393. {$ENDC}
  1394.